CuttingEdge.Conditions reference library |
ValidatorExtensions..::.ContainsAny<(Of <(TCollection, TElement>)>) Method (ConditionValidator<(Of <(TCollection>)>), IEnumerable<(Of <(TElement>)>), String) |
ValidatorExtensions Class See Also Send Feedback |
Checks whether the given value contains any of the specified elements. An
exception is thrown otherwise. When the value is a null reference or an empty list it won't
contain any elements. When the elements list is null or
empty the collection is considered to not contain any element.
Namespace:
CuttingEdge.Conditions
Assembly:
CuttingEdge.Conditions (in CuttingEdge.Conditions.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function ContainsAny(Of TCollection As IEnumerable(Of TElement), TElement) ( _ validator As ConditionValidator(Of TCollection), _ elements As IEnumerable(Of TElement), _ conditionDescription As String _ ) As ConditionValidator(Of TCollection) |
C# |
---|
public static ConditionValidator<TCollection> ContainsAny<TCollection, TElement>( ConditionValidator<TCollection> validator, IEnumerable<TElement> elements, string conditionDescription ) where TCollection : IEnumerable<TElement> |
Visual C++ |
---|
public: generic<typename TCollection, typename TElement> where TCollection : IEnumerable<TElement> static ConditionValidator<TCollection>^ ContainsAny( ConditionValidator<TCollection>^ validator, IEnumerable<TElement>^ elements, String^ conditionDescription ) |
JavaScript |
---|
JavaScript does not support generic types or methods. |
Parameters
- validator
- Type: CuttingEdge.Conditions..::.ConditionValidator<(Of <(TCollection>)>)
The ConditionValidator<(Of <(T>)>) that holds the value that has to be checked.
- elements
- Type: System.Collections.Generic..::.IEnumerable<(Of <(TElement>)>)
The list of elements.
- conditionDescription
- Type: System..::.String
The description of the condition that should hold. The string may hold the placeholder '{0}' for the ArgumentName.
Type Parameters
- TCollection
- The type of the value to check.
- TElement
- The type that can be considered an element of the TCollection.
Return Value
The specified validator instance.Exceptions
Exception | Condition |
---|---|
System..::.ArgumentException | Thrown when the Value of the specified validator does not contain any element of the given elements list, while the specified validator is created using the Requires extension method. |
System..::.ArgumentNullException | Thrown when the Value of the specified validator is a null reference, while the specified validator is created using the Requires extension method. |
CuttingEdge.Conditions..::.PostconditionException | Thrown when the Value of the specified validator does not contain any element of the given elements list, while the specified validator is created using the Ensures extension method. |